import com.beans.User;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryExtensionsKt;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

import java.security.cert.X509Certificate;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2023-02-07
 * Time: 9:16
 */
public class APP {
    public static void main(String[] args) {
        //获取spring上下文
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        User user = (User) context.getBean("userinfo");
        user.sayHi();
    }

    public static void main2(String[] args) {
        //bean工厂
        BeanFactory factory = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
//        User user = (User) factory.getBean("userinfo");
//        user.sayHi();
    }
}
